-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TST: add test for .unique() dtype preserving #29515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TST: add test for .unique() dtype preserving #29515
Conversation
pandas/tests/series/test_dtypes.py
Outdated
@@ -506,6 +506,33 @@ def test_is_homogeneous_type(self): | |||
assert Series([1, 2])._is_homogeneous_type | |||
assert Series(pd.Categorical([1, 2]))._is_homogeneous_type | |||
|
|||
@pytest.mark.parametrize( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should go in pandas/tests/test_algos.py.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @jreback - moved the test there.
pandas/tests/series/test_dtypes.py
Outdated
([1, 2, 2], [1.0, 2.0], "float64"), | ||
([1, 2, 2], [1.0, 2.0], "complex64"), | ||
([1, 2, 2], [1.0, 2.0], "complex128"), | ||
([True, True, False], [True, False], "bool"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would really try to use the existing fixtures for this, e.g. any_numpy_dtype (and just cast the input in numpy before construction), skipping those which don't make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @jreback - now using np.sctypes
to extract all dtypes and skipping [bytes, str, np.void]
.
pandas/tests/test_algos.py
Outdated
@pytest.mark.parametrize( | ||
"data, uniques, dtype_list", | ||
[ | ||
([1, 2, 2], [1, 2], np.sctypes["int"]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would rather not use numpy references here and instead use our fixtures or definitions in pandas/conftest.py they are much more comprehensive and include pandas types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback, @jreback - now using any_numpy_dtype
to extract the dtypes.
94fa0a9
to
14793af
Compare
thanks @ganevgv |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff